﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CPPEI.WorkflowCore
{
    /// <summary>
    ///  流程流转记录,
    ///  记录了流程一个步骤中详细的信息，从谁流转给了谁。
    /// </summary>
    public class ActionRecord
    {
        public Guid Id { get; set; }

        /// <summary>
        /// 流程实例编号
        /// </summary>
        public Guid InstanceId { get; set; }

        /// <summary>
        /// 动作编号
        /// </summary>
        public string Action { get; set; }

        public ActionType ActionType { get; set; }

        /// <summary>
        /// 在哪一个活动执行
        /// </summary>
        public Activity Activity { get; set; }

        /// <summary>
        /// 流程执行人
        /// </summary>
        public Actor Actor { get; set; }

        /// <summary>
        /// 记录时间
        /// </summary>
        public DateTime Time { get; set; }

        /// <summary>
        /// 操作
        /// </summary>
        public UndertakerType UndertakerType { get; set; }

        public ActionRecord(Guid instanceId, 
            string action,
            ActionType actionType,
            Activity activity,
            Actor actor,
            UndertakerType untertakerType)
        {
            Id = Guid.NewGuid();
            this.InstanceId = instanceId;
            this.Action = action;
            this.ActionType = actionType;
            this.Time = DateTime.Now;
            this.Activity = activity;
            this.Actor = actor;
            this.UndertakerType = untertakerType;
        }
    }
}
